package com.jpro.module.bpm.convert.message;

import com.jpro.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
import com.jpro.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
import com.jpro.module.system.api.sms.dto.send.SmsSendSingleToUserReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.Map;

@Mapper
public interface BpmMessageConvert {

    BpmMessageConvert INSTANCE = Mappers.getMapper(BpmMessageConvert.class);

    @Mapping(target = "mobile", ignore = true)
    @Mapping(source = "userId", target = "userId")
    @Mapping(source = "templateCode", target = "templateCode")
    @Mapping(source = "templateParams", target = "templateParams")
    SmsSendSingleToUserReqDTO convert(Long userId, String templateCode, Map<String, Object> templateParams);

    @Mapping(target = "mail", ignore = true)
    @Mapping(source = "userId", target = "userId")
    @Mapping(source = "templateCode", target = "templateCode")
    @Mapping(source = "templateParams", target = "templateParams")
    MailSendSingleToUserReqDTO convertForMailSend(Long userId, String templateCode, Map<String, Object> templateParams);

    @Mapping(source = "userId", target = "userId")
    @Mapping(source = "templateCode", target = "templateCode")
    @Mapping(source = "templateParams", target = "templateParams")
    NotifySendSingleToUserReqDTO convertForMessageSend(Long userId, String templateCode, Map<String, Object> templateParams);
}
